package com.bdqn.serivce;

import com.bdqn.pojo.Dept;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

//微服务的客户端   value对应服务的id名 这样就可以使Feign客户端直接找到对应的微服务
//fallbackFactory  指定降级配置类
@FeignClient(value = "SPRING-CLOUD-PROVIDER-DEPT",fallbackFactory = DeptClientServiceFallBackFactory.class)
@Component
public interface DeptClientService {

    // 这里是 对应服务提供中的服务访问名
    @GetMapping("/dept/getDeptByid/{id}")
    public Dept queryById(@PathVariable("id") Integer id);

    @RequestMapping("/dept/findDeptAll")
    public List<Dept> queryAll();

    @PostMapping("/dept/adddept")
    public boolean addDept(Dept dept);

}
